//
//  KYCityWeatherVC-UI.swift
//  ZhiYunWeather
//
//  Created by Wade on 2024/7/10.
//

import Foundation
import UIKit
import QMUIKit
extension KEMenuDetail{
    func setupSubViews(){
        let contentView = UIView()
        self.view.addSubview(contentView)
        contentView.snp.makeConstraints { make in
            make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top)
            make.left.right.bottom.equalTo(self.view)
        }
        
       
        let backBtn = UIButton()
        backBtn.setImage(.init(named: "ic_back"), for: .normal)
        contentView.addSubview(backBtn)
        backBtn.snp.makeConstraints { make in
            make.width.height.equalTo(40)
            make.top.equalTo(contentView)
            make.left.equalTo(contentView).offset(10)
        }
        backBtn.addTarget(self, action: #selector(backBtnClick), for: .touchUpInside)
        // Create a waterfall layout
        let layout = UICollectionViewFlowLayout()
        layout.scrollDirection = .vertical
        layout.itemSize = CGSizeMake(60, 60)
        layout.minimumLineSpacing = 5;
        layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
        let collectionView = UICollectionView(frame: CGRectZero, collectionViewLayout: layout)
        contentView.addSubview(collectionView)
        collectionView.backgroundColor = .clear
        collectionView.snp.makeConstraints { make in
            make.left.right.bottom.equalTo(contentView)
            make.top.equalTo(backBtn.snp.bottom).offset(30)
        }
        collectionView.delegate = self
        collectionView.dataSource = self
        
        self.collectionView = collectionView
    }
}
